import java.util.LinkedList;
import java.util.*;

public class Views implements java.io.Serializable{

   private LinkedList filesInView = new LinkedList();
   String viewName;
   DBFile file;

   public Views(String inputView) {
      this.viewName = inputView;
   }

   public String getViewName(){
      return viewName;
   }

   public void addFile(DBFile inputFile) {
      file = inputFile;
      filesInView.add(file);
   }

   public void addFiles(LinkedList inputFiles) {
      Iterator iter = inputFiles.listIterator();
      while(iter.hasNext()){
         filesInView.add((DBFile)iter.next());
      }
   }

   public void deleteFile(LinkedList inputFiles) {
      Iterator iter = inputFiles.listIterator();
      while(iter.hasNext()){
         filesInView.remove((DBFile)iter.next());
      }
   }

   public LinkedList getFiles(){
      return filesInView;
   }

   public boolean isFileInView(DBFile inputFile){
      file = inputFile;
      if(filesInView.contains(inputFile)){
         return true;
      }
      else{
         return false;
      }
   }
   public void printFiles(){
      Iterator it = filesInView.listIterator();
      while(it.hasNext()){
         DBFile tempDb = (DBFile)it.next();
         String st = tempDb.getPath();
         System.out.println(st);
      }
   }
}